package abs.service;

import abs.domain.Companias;
import abs.domain.GrupoProveedores;
import abs.domain.Proveedores;
import abs.domain.TipoProveedores;

import java.util.List;
import java.util.Set;

import org.junit.Test;

import org.junit.runner.RunWith;

import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.beans.factory.support.DefaultListableBeanFactory;

import org.springframework.context.ApplicationContext;

import org.springframework.mock.web.MockHttpServletRequest;

import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.TestExecutionListeners;

import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;

import org.springframework.test.context.transaction.TransactionalTestExecutionListener;

import org.springframework.transaction.annotation.Transactional;

import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.RequestScope;
import org.springframework.web.context.request.ServletRequestAttributes;
import org.springframework.web.context.request.SessionScope;

/**
 * Class to run the service as a JUnit test. Each operation in the service is a separate test.
 *
 */

@RunWith(SpringJUnit4ClassRunner.class)
@TestExecutionListeners({
		DependencyInjectionTestExecutionListener.class,
		DirtiesContextTestExecutionListener.class,
		TransactionalTestExecutionListener.class })
@ContextConfiguration(locations = {
		"file:./resources/absWeb-security-context.xml",
		"file:./resources/absWeb-service-context.xml",
		"file:./resources/absWeb-dao-context.xml",
		"file:./resources/absWeb-web-context.xml" })
@Transactional
public class ProveedoresServiceTest {

	/**
	 * The Spring application context.
	 *
	 */
	@SuppressWarnings("unused")
	private ApplicationContext context;

	/**
	 * The service being tested, injected by Spring.
	 *
	 */
	@Autowired
	protected ProveedoresService service;

	/**
	 * Instantiates a new ProveedoresServiceTest.
	 *
	 */
	public ProveedoresServiceTest() {
		setupRequestContext();
	}

	/**
	 * Operation Unit Test
	 * Load an existing Proveedores entity
	 * 
	 */
	@Test
	public void loadProveedoress() {
		Set<Proveedores> response = null;
		response = service.loadProveedoress();
		// TODO: JUnit - Add assertions to test outputs of operation: loadProveedoress
	}

	/**
	 * Operation Unit Test
	 * Save an existing Proveedores entity
	 * 
	 */
	@Test
	public void saveProveedores() {
		// TODO: JUnit - Populate test inputs for operation: saveProveedores 
		Proveedores proveedores = new abs.domain.Proveedores();
		service.saveProveedores(proveedores);
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Companias entity
	 * 
	 */
	@Test
	public void deleteProveedoresCompanias() {
		// TODO: JUnit - Populate test inputs for operation: deleteProveedoresCompanias 
		Integer proveedores_pr100copr = 0;
		String related_companias_co000nocia = null;
		Proveedores response = null;
		response = service.deleteProveedoresCompanias(proveedores_pr100copr, related_companias_co000nocia);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteProveedoresCompanias
	}

	/**
	 * Operation Unit Test
	 * Return all Proveedores entity
	 * 
	 */
	@Test
	public void findAllProveedoress() {
		// TODO: JUnit - Populate test inputs for operation: findAllProveedoress 
		Integer startResult = 0;
		Integer maxRows = 0;
		List<Proveedores> response = null;
		response = service.findAllProveedoress(startResult, maxRows);
		// TODO: JUnit - Add assertions to test outputs of operation: findAllProveedoress
	}

	/**
	 * Operation Unit Test
	 */
	@Test
	public void findProveedoresByPrimaryKey() {
		// TODO: JUnit - Populate test inputs for operation: findProveedoresByPrimaryKey 
		Integer pr100copr = 0;
		Proveedores response = null;
		response = service.findProveedoresByPrimaryKey(pr100copr);
		// TODO: JUnit - Add assertions to test outputs of operation: findProveedoresByPrimaryKey
	}

	/**
	 * Operation Unit Test
	 * Delete an existing GrupoProveedores entity
	 * 
	 */
	@Test
	public void deleteProveedoresGrupoProveedores() {
		// TODO: JUnit - Populate test inputs for operation: deleteProveedoresGrupoProveedores 
		Integer proveedores_pr100copr_1 = 0;
		String related_grupoproveedores_grppr100cdgo = null;
		Proveedores response = null;
		response = service.deleteProveedoresGrupoProveedores(proveedores_pr100copr_1, related_grupoproveedores_grppr100cdgo);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteProveedoresGrupoProveedores
	}

	/**
	 * Operation Unit Test
	 * Save an existing TipoProveedores entity
	 * 
	 */
	@Test
	public void saveProveedoresTipoProveedores() {
		// TODO: JUnit - Populate test inputs for operation: saveProveedoresTipoProveedores 
		Integer pr100copr_1 = 0;
		TipoProveedores related_tipoproveedores = new abs.domain.TipoProveedores();
		Proveedores response = null;
		response = service.saveProveedoresTipoProveedores(pr100copr_1, related_tipoproveedores);
		// TODO: JUnit - Add assertions to test outputs of operation: saveProveedoresTipoProveedores
	}

	/**
	 * Operation Unit Test
	 * Save an existing Companias entity
	 * 
	 */
	@Test
	public void saveProveedoresCompanias() {
		// TODO: JUnit - Populate test inputs for operation: saveProveedoresCompanias 
		Integer pr100copr_2 = 0;
		Companias related_companias = new abs.domain.Companias();
		Proveedores response = null;
		response = service.saveProveedoresCompanias(pr100copr_2, related_companias);
		// TODO: JUnit - Add assertions to test outputs of operation: saveProveedoresCompanias
	}

	/**
	 * Operation Unit Test
	 * Delete an existing TipoProveedores entity
	 * 
	 */
	@Test
	public void deleteProveedoresTipoProveedores() {
		// TODO: JUnit - Populate test inputs for operation: deleteProveedoresTipoProveedores 
		Integer proveedores_pr100copr_2 = 0;
		String related_tipoproveedores_tipopr100cdgo = null;
		Proveedores response = null;
		response = service.deleteProveedoresTipoProveedores(proveedores_pr100copr_2, related_tipoproveedores_tipopr100cdgo);
		// TODO: JUnit - Add assertions to test outputs of operation: deleteProveedoresTipoProveedores
	}

	/**
	 * Operation Unit Test
	 * Save an existing GrupoProveedores entity
	 * 
	 */
	@Test
	public void saveProveedoresGrupoProveedores() {
		// TODO: JUnit - Populate test inputs for operation: saveProveedoresGrupoProveedores 
		Integer pr100copr_3 = 0;
		GrupoProveedores related_grupoproveedores = new abs.domain.GrupoProveedores();
		Proveedores response = null;
		response = service.saveProveedoresGrupoProveedores(pr100copr_3, related_grupoproveedores);
		// TODO: JUnit - Add assertions to test outputs of operation: saveProveedoresGrupoProveedores
	}

	/**
	 * Operation Unit Test
	 * Delete an existing Proveedores entity
	 * 
	 */
	@Test
	public void deleteProveedores() {
		// TODO: JUnit - Populate test inputs for operation: deleteProveedores 
		Proveedores proveedores_1 = new abs.domain.Proveedores();
		service.deleteProveedores(proveedores_1);
	}

	/**
	 * Operation Unit Test
	 * Return a count of all Proveedores entity
	 * 
	 */
	@Test
	public void countProveedoress() {
		Integer response = null;
		response = service.countProveedoress();
		// TODO: JUnit - Add assertions to test outputs of operation: countProveedoress
	}

	/**
	 * Autowired to set the Spring application context.
	 *
	 */
	@Autowired
	public void setContext(ApplicationContext context) {
		this.context = context;
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("session", new SessionScope());
		((DefaultListableBeanFactory) context.getAutowireCapableBeanFactory()).registerScope("request", new RequestScope());
	}

	/**
	 * Sets Up the Request context
	 *
	 */
	private void setupRequestContext() {
		MockHttpServletRequest request = new MockHttpServletRequest();
		ServletRequestAttributes attributes = new ServletRequestAttributes(request);
		RequestContextHolder.setRequestAttributes(attributes);
	}
}
